package com.hz.pay.center.service.impl;

import cn.hutool.core.lang.Snowflake;
import com.hz.pay.center.model.RefundSerialsInfo;
import com.hz.pay.center.service.IRefundSerialService;
import com.pay.common.req.RefundReq;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class RefundSerialServiceImpl implements IRefundSerialService {


    @Override
    public RefundSerialsInfo createRefundSerial(RefundReq refundReq) {

        RefundSerialsInfo refundSerialsInf = new RefundSerialsInfo();

        refundSerialsInf.setRefundAmt(refundReq.getRefundAmt());
        refundSerialsInf.setPaySerilNo(refundReq.getOrderId()); //TODO

        Snowflake snowflake = new Snowflake(0,0);

        refundSerialsInf.setRefundSerialNo(snowflake.nextIdStr());

        refundSerialsInf.setRefundStatus("1");


        //set

        return refundSerialsInf;

    }

    @Override
    public List<RefundSerialsInfo> queryByPaySerialNo(String paySerialNo) {

        // select * from tb_refund_serials where ori_pay_serial_no = ? and  refund_status = in （1：退款申请中，2：银行处理中，退款成功）
        return null;
    }

    @Override
    public void updateRefundSerial(RefundSerialsInfo refundSerialsInfo) {

    }
}
